package com.xyd.springcloud.controller;

import com.xyd.springcloud.model.User;
import com.xyd.springcloud.service.ISpringcloudService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private ISpringcloudService springcloudService;


    @RequestMapping("/all")
    public List<User> selectAllUsers() {
        return springcloudService.getAllUser();
    }

    @GetMapping("/login")
    public User userLogin(User user) {
        User u = springcloudService.userLogin(user);
        System.out.println("feignControl==" + user.getUserName());
        return u;

    }
}
